<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        table{
            border-collapse: collapse;


        }
       table tr td{
            border: solid red 1px;
        }
    </style>
</head>
<body>
    <div id="app">
        <input type="text" name="" id="" v-model='cc' placeholder="请输入搜索的学生名">
        <input type="text" name="" id="" v-model='pp' placeholder="请输入姓名">
        <input type="text" name="" id="" v-model='aa' placeholder="请输入性别">
        <input type="text" name="" id="" v-model='bb' placeholder="请输入年龄">
        <button type="button" @click='add'>添加</button>
        <table>
            <tr>
                <td>学号</td>
                <td>姓名</td>
                <td>性别</td>
                <td>年龄</td>
            </tr>
            <tr v-for="item in stu">
                <td>{{item.id}}</td>
                <td>{{item.name}}</td>
                <td>{{item.sex}}</td>
                <td>{{item.age}}</td>
            </tr>

        </table>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        var app=new Vue({
            el:'#app',
            data:{
                pp:'',
                aa:'',
                bb:'',
                stu:[
                    {'id':1,'name':'科比','sex':'男','age':41},
                    {'id':2,'name':'艾弗森','sex':'男','age':40},
                    {'id':3,'name':'麦迪','sex':'男','age':39},
                    {'id':4,'name':'卡特','sex':'男','age':42}
                ]
            },
            methods:{
                add:function(){
                    var lili=this.stu.length
                    this.stu.push({'id':lili+1,'name':this.pp,'sex':this.aa,'age':this.bb})
                    
                }
            },

        })

    </script>
</body>
</html>